package br.usp.pcs.basys2.event;

import java.util.Calendar;

import br.usp.pcs.basys2.BasysProcess;
import br.usp.pcs.basys2.engine.Engine;
import br.usp.pcs.basys2.processor.ProcessorManager;

public class TimeSliceReachedEvent extends Event {

	public TimeSliceReachedEvent(BasysProcess process, Calendar dateOfArrival) {
		super(process, dateOfArrival);
	}

	@Override
	public void execute() {
		ProcessorManager processorManager = Engine.getInstance().getSystem().getProcessorManager();
		if (processorManager.getRunningProcess().equals(this.getProcess())) {
			processorManager.advanceQueue();
		}
	}

}
